'''
Created on 22 Mar 2011

@author: keith
'''
import re, os, sys

def locations():
    pass

def parse():
    f = open("../gardai.ner", 'r')
    stuff = f.read()

    regexString = r'[^\| \n]*\|[^\| \n]*\|[^\| \n]*'
    regex = re.compile(regexString,re.M | re.I)
    
    all = regex.findall(stuff)
    tags = {}
    
    for tag in all:
        splittag = tag.split('|')
        if tags.has_key(splittag[2]):
            tags[splittag[2]].append(splittag[0])
        else:
            tags[splittag[2]] = [splittag[0]]
    print tags['I-LOC']
    
if __name__ == '__main__':
    parse()